<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${path}/pages/">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <title>个人主页</title>
  <link rel="stylesheet" href="../layui/css/layui.css" media="all">
</head>
<body>
	<div style="margin:0 auto; "  class="layui-row" id="reviews">
	
    		
    		
		</div>
</body>
<script type="text/html" id="laytplContentReview">
{{#  layui.each(d, function(index, item){ }}
	<hr class="layui-bg-gray">
    <div class="layui-row grid-demo">
	<div class="layui-col-md1" >
		<a href="${path}/action/movie/movieInfo?id={{ item.movieId }}" target="_parent"><img src="{{ item.movie.moviePicture }}" alt="一出好戏"  data-x="1080" data-y="1512" style="display: inline; width: 68px; height: 94.94px"></a>
	</div>
	<div class="layui-col-md11">
		<h3>
			<a style="color: #669;text-decoration: none;" href="${path}/action/review/findById?id={{ item.id }}" target="_parent" class="">{{ item.title }}</a>
		</h3>
		<div class="layui-row-md1" style="color: #666; padding: 5px 0;">
                <a href="writer_info.jsp">{{ item.writer.userName }}</a> 评论
                <a href="${path}/action/movie/movieInfo?id={{ item.movieId }} " target="_parent">{{ item.movie.movieName }}</a>
                <span class="rating">
					
					{{# for(var i=1; i<=item.rating; i++){ }} 
						<img src="../img/star_onmouseover.png" id="star${i}" width="16" height="16">
					{{# } }}
					{{# for(var i=1; i<=5-item.rating; i++){ }} 
						<img src="../img/star_hollow_hover.png" id="star${5-i}" width="16" height="16">
					{{# } }}                	

    			</span>
        </div>
        <div class="layui-row-md3">
			<span>
				{{ item.content.substring(0,150) }}
			</span>
            <a href="${path}/action/review/findById?id={{ item.id }}" target="_parent">...(全文)</a>
        </div>
	</div>

</div>
{{# })  }}
  </script>
  
<script src="../layui/layui.js"></script>
<script>

layui.use(['layer','jquery','laytpl'], function(){
	var $ = layui.$;
	var layer = layui.layer;
	var laytpl=layui.laytpl;
	var userName,phoneNumber,email;
	
	var writerId=parent.document.getElementById('writerId').value;
	
	$.getJSON('${path}/action/review/findByUserId',{userId:writerId} ,function(data) {
		  var tpl = $('#laytplContentReview').html();
	      laytpl(tpl).render(data, function(html){
	      		$("#reviews").html (html);
	      		var height = document.body.offsetHeight;
	      		parent.document.getElementById('iframe1').height = height + 30;
	      });
	});	
	
	
})




</script>
</html>